<template>
  <div id="wrapper">
      <h1>{{remSize}}</h1>
    <button @click="$router.push({path:'/witness'})">进行人证</button>
    <button @click="readIdCard">测试读取身份证</button>
    <p>{{idCard}}</p>
  </div>
</template>

<script>
  export default {
    name: 'index',
    data(){
        return{
            remSize:0,
            idCard:null,
            canReadIdCard:true
        }
    },
    created(){
        this.remSize= document.documentElement.style.fontSize ;
        //监听身份证
        this.$electron.ipcRenderer.on("getIdCardInfo",(e,info)=>{
            this.idCard=info;
            this.canReadIdCard=true;
        })
    },
    methods: {
        //读取身份证
        readIdCard(){
            if(!this.canReadIdCard){
                return false;
            }
            this.canReadIdCard=false;
            this.$electron.ipcRenderer.send("readIdCard");
        }
    }
  }
</script>

<style>

</style>